﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace iTeamyou.LTS.Core.Models
{
    /// <summary>
    /// 批次证照
    /// </summary>
    public class BatchLicense
    {
        /// <summary>
        /// 证照编码
        /// </summary>
        [DisplayName("证照编码")]
        [Description("证照编码")]
        [Required(ErrorMessage = "证照编码不能为空")]
        public string LId { get; set; }

        /// <summary>
        /// 证照名称
        /// </summary>
        [DisplayName("证照名称")]
        [Description("证照名称")]
        [Required(ErrorMessage = "证照名称不能为空")]
        public string Name { get; set; }

        /// <summary>
        /// 标签
        /// </summary>
        [DisplayName("标签")]
        [Description("标签")]
        [Required(ErrorMessage = "标签不能为空")]
        public string Type { get; set; }

        /// <summary>
        /// 批次Id
        /// </summary>
        [DisplayName("批次Id")]
        [Description("批次Id")]
        [Required(ErrorMessage = "批次Id不能为空")]
        public string BatchId { get; set; }

        /// <summary>
        /// 批次号
        /// </summary>
        [DisplayName("批次号")]
        [Description("批次号")]
        [Required(ErrorMessage = "批次号不能为空")]
        public string Number { get; set; }

        /// <summary>
        /// 入库时间
        /// </summary>
        [DisplayName("入库时间")]
        [Description("入库时间")]
        public DateTime? EntryDatetime { get; set; }

        /// <summary>
        /// 剩余有效时间
        /// </summary>
        [DisplayName("剩余有效时间")]
        [Description("剩余有效时间")]
        [NotMapped]
        public int? RemainingDays { get; set; }

        /// <summary>
        /// 有效开始日期
        /// </summary>
        [DisplayName("有效开始日期")]
        [Description("有效开始日期")]
        [Required(ErrorMessage = "有效开始日期不能为空")]
        public DateTime? ValidFromDate { get; set; }

        /// <summary>
        /// 有效结束日期
        /// </summary>
        [DisplayName("有效结束日期")]
        [Description("有效结束日期")]
        [Required(ErrorMessage = "有效结束日期不能为空")]
        public DateTime? ValidToDate { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [DisplayName("创建时间")]
        [Description("创建时间")]
        public DateTime? CreatedOn { get; set; }

        /// <summary>
        /// 创建者
        /// </summary>
        [DisplayName("创建者")]
        [Description("创建者")]
        public string CreatedBy { get; set; }

        /// <summary>
        /// 最近更新时间
        /// </summary>
        [DisplayName("最近更新时间")]
        [Description("最近更新时间")]
        public DateTime? LastModifiedOn { get; set; }

        /// <summary>
        /// 最近更新者
        /// </summary>
        [DisplayName("最近更新者")]
        [Description("最近更新者")]
        public string LastModifiedBy { get; set; }

        /// <summary>
        /// 证照附件URL
        /// </summary>
        [DisplayName("证照附件")]
        [BizDataType("ListURL")]
        [Description("证照附件")]
        [NotMapped]
        public List<string>? AttachmentURL { get; set; }

        /// <summary>
        /// 证照附件
        /// </summary>
        [DisplayName("证照附件")]
        [Required]
        public List<BatchLicenseAttachment> Attachments { get; set; }

        /// <summary>
        /// 是否已发布
        /// </summary>
        public bool IsPublish { get; set; }

        /// <summary>
        /// 关联流程标识
        /// </summary>
        public string RefFlowId { get; set; }

        [Required]
        public Batch Batch { get; set; }

        /// <summary>
        /// 系统唯一标识
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 证照状态
        /// </summary>
        public LicenseOp OperationType { get; set; }
    }
}

